package cn.itcast.nems.config;

import cn.itcast.nems.manager.auth.KeycloakConfig;
import cn.itcast.nems.manager.scrm.SCRMManager;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * author: yong.li
 * create: 2023-08-21 16:14:54
 **/
@Configuration
@ConfigurationProperties(prefix = "scrm")
@Setter
@Getter
public class SCRMConfig {
    private String domain;
    private String okcTokenUrl;
    private String okcClientId;
    private String okcSecret;

    @Bean
    public SCRMManager scrmManager() {
        KeycloakConfig kc = new KeycloakConfig(okcTokenUrl, okcClientId, okcSecret);
        return new SCRMManager(domain, kc);
    }
}
